#
echo "欢迎使用此程序安装seafile企业版……"

read -p "请输入管理员账号（邮箱）" email
read -p "请输入管理员密码" password
read -p "请输入域名或者IP地址" hostname
read -p "是否开启https?(默认开启，不开启输入任意字符）" ssl
read -p "请输入ElasticSearch的最小和最大占用内存，空格隔开,例如：512m,1g（ Xms , Xmx )" es_min es_max

wget -O docker-compose.yml https://gitee.com/jinyubo/shell/raw/master/docker-compose-seafile.yml

sed -i "" 's/me@example.com/$email/g' docker-compose.yml

sed -i "" 's/asecret/$password/g' docker-compose.yml

sed -i "" 's/seafile.example.com/$hostname/g' docker-compose.yml

if [ -z $ssl ] 
then 

sed -i "" 's/#     - "443:443"/      - "443:443"/g' docker-compose.yml
sed -i "" 's/- SEAFILE_SERVER_LETSENCRYPT=false/- SEAFILE_SERVER_LETSENCRYPT=true/g' docker-compose.yml

fi

sed -i "" 's/ES_JAVA_OPTS=-Xms1g -Xmx1g/ES_JAVA_OPTS=-Xms$es_min -Xmx$es_max/g' docker-compose.yml


#docker-compose up -d
